package com.sangeng.controller;

import com.sangeng.dto.LinkDTO;
import com.sangeng.dto.UpdateCategoryDTO;
import com.sangeng.entity.ResponseResult;
import com.sangeng.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/content/link")
@RestController
public class LinkController {
    @Autowired
LinkService linkService;
//    @GetMapping("/list")
//    public ResponseResult getCategoryList(Integer pageNum, Integer pageSize){
//
//
//        return  linkService.getLinkList(pageNum,pageSize);
//
//
//    }

    @DeleteMapping("/{idList}")
    public ResponseResult deleteLink(@PathVariable List<Long> idList){

        return   linkService.deleteLink(idList);

    }

    @GetMapping("/{id}")
    public ResponseResult getLinkById(@PathVariable Long id){

        return linkService.getLinkById(id);


    }
    @GetMapping("/list")
    public ResponseResult getLinkList(Integer pageNum,Integer pageSize,String name,String status){


        return linkService.getLinkListByRequire(pageNum,pageSize,name,status);

    }
    @PutMapping
    public ResponseResult updateCategory(@RequestBody LinkDTO linkDTO){

        return linkService.updateLink(linkDTO);


    }

}
